<?php

namespace common\models\user;

use Yii;

/**
 * This is the model class for table "{{%user_account_log}}".
 *
 * @property int $id
 * @property int $user_id 用户ID
 * @property int $account_id 账户ID
 * @property int $balance 结算方式，1收入，0冻结，-1支出
 * @property int $value 结算金额
 * @property int $recharge 手续费
 * @property int $original 结算前账户积分
 * @property int $trade_id 交易ID
 * @property string $mark 日志备注
 * @property int $ip 日志记录IP
 * @property int $admin_id 操作管理员ID
 * @property int $status 日志状态
 * @property int $created_at 创建时间
 * @property int $updated_at 更新时间
 * @property int $deleted_at 删除时间
 */
class UserAccountLog extends \common\db\ActiveRecord {

    use \common\traits\Constants;

    const STATUS_DEFAULT = 0;
    const STATUS_ACTIVE = 10;
    //
    const BALANCE_IN = 1;
    const BALANCE_OUT = -1;
    const BALANCE_FROZEN = 0;

    /**
     * {@inheritdoc}
     */
    public static function tableName() {
        return '{{%user_account_log}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules() {
        return [
            [['user_id', 'account_id', 'balance', 'value', 'original', 'recharge', 'trade_id', 'ip', 'admin_id', 'status', 'created_at', 'updated_at', 'deleted_at'], 'integer'],
            [['mark'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels() {
        return [
            'id' => 'ID',
            'user_id' => '用户ID',
            'account_id' => '账户ID',
            'balance' => '结算方式',
            'value' => '结算金额',
            'original' => '结算前账户积分',
            'recharge' => '手续费',
            'trade_id' => '交易ID',
            'mark' => '日志备注',
            'ip' => '日志记录IP',
            'admin_id' => '操作管理员ID',
            'status' => '日志状态',
            'created_at' => '日志时间',
            'updated_at' => '更新时间',
            'deleted_at' => '删除时间',
        ];
    }

}
